
package com.primeton.eos.oss.model.service;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.eos.system.utility.PageResultList;

import com.eos.data.datacontext.DataContextManager;
import com.eos.data.datacontext.IMUODataContext;

import com.primeton.eos.oss.model.dao.MdmCrecAccountHisDao;
import com.primeton.eos.oss.model.newdataset.MdmCrecAccountHis;

@Service
public class MdmCrecAccountHisService {

    @Autowired
    private MdmCrecAccountHisDao mdmCrecAccountHisDao;


    public PageResultList<MdmCrecAccountHis> queryMdmCrecAccountHissWithPage(String username,  int pageSize, int pageIndex) {
        //TODO 记录日志
        return mdmCrecAccountHisDao.queryMdmCrecAccountHissWithPage(username,  pageSize, pageIndex);
    }

    public MdmCrecAccountHis getMdmCrecAccountHisById(String id) {
        //TODO 记录日志
        return mdmCrecAccountHisDao.getEntity(MdmCrecAccountHis.QNAME, id);
    }

    @Transactional
    public void createMdmCrecAccountHis(MdmCrecAccountHis mdmCrecAccountHis) {
        //TODO 记录日志
    	String userName = "";
		IMUODataContext muo = DataContextManager.current().getMUODataContext();
		if (muo != null) {
			userName = muo.getUserObject().getUserName();
		}
        mdmCrecAccountHis.set("createUser", userName);
        mdmCrecAccountHis.set("createTime", new Date());
        mdmCrecAccountHis.set("updateUser", userName);
        mdmCrecAccountHis.set("updateTime", new Date());

        mdmCrecAccountHisDao.getPrimaryKey(mdmCrecAccountHis);
        mdmCrecAccountHisDao.insertEntity(mdmCrecAccountHis);
    }
    
    @Transactional
    public void modifyMdmCrecAccountHis(MdmCrecAccountHis mdmCrecAccountHis) {
        //TODO 记录日志
     	String userName = "";
		IMUODataContext muo = DataContextManager.current().getMUODataContext();
		if (muo != null) {
			userName = muo.getUserObject().getUserName();
		}
        mdmCrecAccountHis.set("updateUser", userName);
        mdmCrecAccountHis.set("updateTime", new Date());
 
        mdmCrecAccountHisDao.updateEntity(mdmCrecAccountHis);
    }
    
     @Transactional
    public void removeMdmCrecAccountHis(MdmCrecAccountHis[] mdmCrecAccountHis) {
        //TODO 记录日志
        mdmCrecAccountHisDao.deleteEntity(mdmCrecAccountHis);
    }

}





